package com.pz.chat.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

@Data
@TableName("ums_chat_message")
public class ChatMessageEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Long msgId;

    private String fromId;  //消息来源的ID, 0 代表是服务端的消息
    private String toId;    //消息发送对象的ID
    private Date sendTime;  //发送时间
    private Integer type; //消息类型
    private Integer code; //消息的code，0:正常， 非0:异常
    private Integer status; // 0: 未读；1: 已读
    private String msgContent; //消息内容

    public ChatMessageEntity(String fromId, String toId, String msgContent, Integer type, Integer code, Integer status) {
        this.fromId = fromId;
        this.toId = toId;
        this.sendTime = new Date();
        this.msgContent = msgContent;
        this.type = type;
        this.code = code;
        this.status = status;
    }

    public ChatMessageEntity() {}
}
